<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ADC: ADC_Module.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ADC
   &#160;<span id="projectnumber">9.2</span>
   </div>
   <div id="projectbrief">Analog to Digital Conversor library for the Teensy 3.0 microprocessor</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_a_d_c___module_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">ADC_Module.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Teensy 4.x, 3.x, LC ADC library</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * https://github.com/pedvide/ADC</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Copyright (c) 2020 Pedro Villanueva</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * a copy of this software and associated documentation files (the</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * &quot;Software&quot;), to deal in the Software without restriction, including</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * without limitation the rights to use, copy, modify, merge, publish,</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * distribute, sublicense, and/or sell copies of the Software, and to</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * permit persons to whom the Software is furnished to do so, subject to</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * the following conditions:</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * The above copyright notice and this permission notice shall be</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * included in all copies or substantial portions of the Software.</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> * SOFTWARE.</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">/* ADC_Module.h: Declarations of the fuctions of a Teensy 3.x, LC ADC module</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#ifndef ADC_MODULE_H</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#define ADC_MODULE_H</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160; </div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#include &lt;Arduino.h&gt;</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#include &lt;atomic.h&gt;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="preprocessor">#include &lt;settings_defines.h&gt;</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="keyword">using</span> <a class="code" href="namespace_a_d_c___error.html#ad050c44d1f3422d02e5f9726edeee8f0">ADC_Error::ADC_ERROR</a>;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="keyword">using namespace </span><a class="code" href="namespace_a_d_c__settings.html">ADC_settings</a>;</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160; </div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">// debug mode: blink the led light</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="preprocessor">#define ADC_debug 0</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160; </div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html">   54</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_a_d_c___module.html">ADC_Module</a> {</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160; </div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="preprocessor">#if ADC_DIFF_PAIRS &gt; 0</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;  <span class="keyword">struct </span>ADC_NLIST {</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    uint8_t pin, sc1a;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;  };</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160; </div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="preprocessor">#if ADC_DIFF_PAIRS &gt; 0</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160; </div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;  <a class="code" href="class_a_d_c___module.html">ADC_Module</a>(uint8_t ADC_number, <span class="keyword">const</span> uint8_t *<span class="keyword">const</span> a_channel2sc1a,</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;             <span class="keyword">const</span> ADC_NLIST *<span class="keyword">const</span> a_diff_table, ADC_REGS_t &amp;a_adc_regs);</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160; </div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;  <a class="code" href="class_a_d_c___module.html">ADC_Module</a>(uint8_t ADC_number, <span class="keyword">const</span> uint8_t *<span class="keyword">const</span> a_channel2sc1a,</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;             ADC_REGS_t &amp;a_adc_regs);</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160; </div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160; </div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;  <span class="keywordtype">void</span> recalibrate();</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;  <span class="keywordtype">void</span> calibrate();</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; </div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;  <span class="keywordtype">void</span> wait_for_cal();</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160; </div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160; </div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;  <span class="keywordtype">void</span> setReference(<a class="code" href="namespace_a_d_c__settings.html#a5f42fd9e070e88475ec7cee39bbf4f8d">ADC_REFERENCE</a> ref_type);</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160; </div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;  <span class="keywordtype">void</span> setResolution(uint8_t bits);</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160; </div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;  uint8_t getResolution();</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160; </div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;  uint32_t getMaxValue();</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160; </div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;  <span class="keywordtype">void</span> setConversionSpeed(<a class="code" href="namespace_a_d_c__settings.html#aab853fc1fcb1992fd5d51408adf7688e">ADC_CONVERSION_SPEED</a> speed);</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160; </div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;  <span class="keywordtype">void</span> setSamplingSpeed(<a class="code" href="namespace_a_d_c__settings.html#af0d80a1aae7288f77b13f0e01d9da0d3">ADC_SAMPLING_SPEED</a> speed);</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160; </div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;  <span class="keywordtype">void</span> setAveraging(uint8_t num);</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160; </div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;  <span class="keywordtype">void</span> enableInterrupts(<span class="keywordtype">void</span> (*isr)(<span class="keywordtype">void</span>), uint8_t priority = 255);</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160; </div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;  <span class="keywordtype">void</span> disableInterrupts();</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160; </div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;<span class="preprocessor">#ifdef ADC_USE_DMA</span></div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160; </div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;  <span class="keywordtype">void</span> enableDMA();</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160; </div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;  <span class="keywordtype">void</span> disableDMA();</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160; </div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;  <span class="keywordtype">void</span> enableCompare(int16_t compValue, <span class="keywordtype">bool</span> greaterThan);</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160; </div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;  <span class="keywordtype">void</span> enableCompareRange(int16_t lowerLimit, int16_t upperLimit,</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;                          <span class="keywordtype">bool</span> insideRange, <span class="keywordtype">bool</span> inclusive);</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160; </div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;  <span class="keywordtype">void</span> disableCompare();</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160; </div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;<span class="preprocessor">#ifdef ADC_USE_PGA</span></div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160; </div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;  <span class="keywordtype">void</span> enablePGA(uint8_t gain);</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160; </div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;  uint8_t getPGA();</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160; </div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;  <span class="keywordtype">void</span> disablePGA();</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160; </div>
<div class="line"><a name="l00262"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a8b00e0669bbc7917544d4e2e543f1a27">  262</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#a8b00e0669bbc7917544d4e2e543f1a27">continuousMode</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;    atomic::setBitFlag(adc_regs.GC, ADC_GC_ADCO);</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;    atomic::setBitFlag(adc_regs.SC3, ADC_SC3_ADCO);</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;  }</div>
<div class="line"><a name="l00270"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a0f7d83ced9a5159b1f25bd998cea2bd0">  270</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#a0f7d83ced9a5159b1f25bd998cea2bd0">singleMode</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;    atomic::clearBitFlag(adc_regs.GC, ADC_GC_ADCO);</div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;    atomic::clearBitFlag(adc_regs.SC3, ADC_SC3_ADCO);</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;  }</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160; </div>
<div class="line"><a name="l00279"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a7edf0189517f42a2bcbc389c116d9f58">  279</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#a7edf0189517f42a2bcbc389c116d9f58">singleEndedMode</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;<span class="comment">// Teensy 4 is always single-ended</span></div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;    atomic::clearBitFlag(adc_regs.SC1A, ADC_SC1_DIFF);</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;  }</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;<span class="preprocessor">#if ADC_DIFF_PAIRS &gt; 0</span></div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;  <span class="keywordtype">void</span> differentialMode() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;    atomic::setBitFlag(adc_regs.SC1A, ADC_SC1_DIFF);</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;  }</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160; </div>
<div class="line"><a name="l00294"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a4f8137bfcdc459b4f8767ad46f325af6">  294</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#a4f8137bfcdc459b4f8767ad46f325af6">setSoftwareTrigger</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;    atomic::clearBitFlag(adc_regs.CFG, ADC_CFG_ADTRG);</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;    atomic::clearBitFlag(adc_regs.SC2, ADC_SC2_ADTRG);</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;  }</div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160; </div>
<div class="line"><a name="l00303"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#aa5f004d8433dc5968af0ec7f17b1f576">  303</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#aa5f004d8433dc5968af0ec7f17b1f576">setHardwareTrigger</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;    atomic::setBitFlag(adc_regs.CFG, ADC_CFG_ADTRG);</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;    atomic::setBitFlag(adc_regs.SC2, ADC_SC2_ADTRG);</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;  }</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160; </div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160; </div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160; </div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160; </div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160; </div>
<div class="line"><a name="l00323"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a9facd614ff4fec667341d9109f098f0f">  323</a></span>&#160;  <span class="keyword">volatile</span> <span class="keywordtype">bool</span> <a class="code" href="class_a_d_c___module.html#a9facd614ff4fec667341d9109f098f0f">isConverting</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;    <span class="keywordflow">return</span> atomic::getBitFlag(adc_regs.GS, ADC_GS_ADACT);</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    <span class="keywordflow">return</span> atomic::getBitFlag(adc_regs.SC2, ADC_SC2_ADACT);</div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;  }</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160; </div>
<div class="line"><a name="l00340"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a3aefadc245d1582d3ae97e1b9c7acac8">  340</a></span>&#160;  <span class="keyword">volatile</span> <span class="keywordtype">bool</span> <a class="code" href="class_a_d_c___module.html#a3aefadc245d1582d3ae97e1b9c7acac8">isComplete</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;    <span class="keywordflow">return</span> atomic::getBitFlag(adc_regs.HS, ADC_HS_COCO0);</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;    <span class="keywordflow">return</span> atomic::getBitFlag(adc_regs.SC1A, ADC_SC1_COCO);</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;  }</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160; </div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;<span class="preprocessor">#if ADC_DIFF_PAIRS &gt; 0</span></div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160; </div>
<div class="line"><a name="l00353"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a4f6124f3fee4cae59f011184525822a6">  353</a></span>&#160;  <span class="keyword">volatile</span> <span class="keywordtype">bool</span> <a class="code" href="class_a_d_c___module.html#a4f6124f3fee4cae59f011184525822a6">isDifferential</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;    <span class="keywordflow">return</span> atomic::getBitFlag(adc_regs.SC1A, ADC_SC1_DIFF);</div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;  }</div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160; </div>
<div class="line"><a name="l00362"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a038874878778ef351e45f902fcee47df">  362</a></span>&#160;  <span class="keyword">volatile</span> <span class="keywordtype">bool</span> <a class="code" href="class_a_d_c___module.html#a038874878778ef351e45f902fcee47df">isContinuous</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;    <span class="keywordflow">return</span> atomic::getBitFlag(adc_regs.GC, ADC_GC_ADCO);</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;    <span class="keywordflow">return</span> atomic::getBitFlag(adc_regs.SC3, ADC_SC3_ADCO);</div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;  }</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160; </div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;<span class="preprocessor">#ifdef ADC_USE_PGA</span></div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160; </div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;  <span class="keyword">volatile</span> <span class="keywordtype">bool</span> isPGAEnabled() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;    <span class="keywordflow">return</span> atomic::getBitFlag(adc_regs.PGA, ADC_PGA_PGAEN);</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;  }</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160; </div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160; </div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160; </div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160; </div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;  <span class="keywordtype">bool</span> checkPin(uint8_t pin);</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160; </div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160; </div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;  <span class="keywordtype">bool</span> checkDifferentialPins(uint8_t pinP, uint8_t pinN);</div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160; </div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160; </div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160; </div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160; </div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;  <span class="keywordtype">void</span> startReadFast(uint8_t pin); <span class="comment">// helper method</span></div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160; </div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;<span class="preprocessor">#if ADC_DIFF_PAIRS &gt; 0</span></div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160; </div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;  <span class="keywordtype">void</span> startDifferentialFast(uint8_t pinP, uint8_t pinN);</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160; </div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160; </div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160; </div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160; </div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;  <span class="keywordtype">int</span> analogRead(uint8_t pin);</div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160; </div>
<div class="line"><a name="l00459"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a6eaddace77e00a063abeb7331fae6abe">  459</a></span>&#160;  <span class="keywordtype">int</span> <a class="code" href="class_a_d_c___module.html#a6eaddace77e00a063abeb7331fae6abe">analogRead</a>(<a class="code" href="namespace_a_d_c__settings.html#a8c2a64f3fca3ac6b82e8df8cf44f6ca2">ADC_INTERNAL_SOURCE</a> pin) __attribute__((always_inline)) {</div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;    <span class="keywordflow">return</span> analogRead(<span class="keyword">static_cast&lt;</span>uint8_t<span class="keyword">&gt;</span>(pin));</div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;  }</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160; </div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;<span class="preprocessor">#if ADC_DIFF_PAIRS &gt; 0</span></div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160; </div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;  <span class="keywordtype">int</span> analogReadDifferential(uint8_t pinP, uint8_t pinN);</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160; </div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160; </div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160; </div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160; </div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;  <span class="keywordtype">bool</span> startSingleRead(uint8_t pin);</div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160; </div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160;<span class="preprocessor">#if ADC_DIFF_PAIRS &gt; 0</span></div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160; </div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;  <span class="keywordtype">bool</span> startSingleDifferential(uint8_t pinP, uint8_t pinN);</div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160; </div>
<div class="line"><a name="l00517"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a60d0edc82fd1dbb2e20d090a53718ce2">  517</a></span>&#160;  <span class="keywordtype">int</span> <a class="code" href="class_a_d_c___module.html#a60d0edc82fd1dbb2e20d090a53718ce2">readSingle</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;    <span class="keywordflow">return</span> analogReadContinuous();</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;  }</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160; </div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160; </div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160; </div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160; </div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;  <span class="keywordtype">bool</span> startContinuous(uint8_t pin);</div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160; </div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;<span class="preprocessor">#if ADC_DIFF_PAIRS &gt; 0</span></div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160; </div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;  <span class="keywordtype">bool</span> startContinuousDifferential(uint8_t pinP, uint8_t pinN);</div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160; </div>
<div class="line"><a name="l00563"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a8bddd248a9d52110b923fa94438f7f0a">  563</a></span>&#160;  <span class="keywordtype">int</span> <a class="code" href="class_a_d_c___module.html#a8bddd248a9d52110b923fa94438f7f0a">analogReadContinuous</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;    <span class="keywordflow">return</span> (int16_t)(int32_t)adc_regs.R0;</div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;#<span class="keywordflow">else</span></div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;    return (int16_t)(int32_t)adc_regs.RA;</div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;#endif</div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;  }</div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160; </div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;  <span class="keywordtype">void</span> stopContinuous();</div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160; </div>
<div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160; </div>
<div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;  <span class="comment">// The general API is:</span></div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;  <span class="comment">// void startTimer(uint32_t freq)</span></div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;  <span class="comment">// void stopTimer()</span></div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;  <span class="comment">// uint32_t getTimerFrequency()</span></div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;  <span class="comment">// For each board the best timer method will be selected</span></div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160; </div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160; </div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;<span class="preprocessor">#if defined(ADC_USE_PDB)</span></div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160; </div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160; </div>
<div class="line"><a name="l00598"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#aebdd7b54f91fe0834321fb632177151e">  598</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#aebdd7b54f91fe0834321fb632177151e">startTimer</a>(uint32_t freq) __attribute__((always_inline)) {</div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;    startPDB(freq);</div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;  }</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160; </div>
<div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;  <span class="keywordtype">void</span> startPDB(uint32_t freq);</div>
<div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160; </div>
<div class="line"><a name="l00610"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a4361eec1c9f93a99661afb1a43d15284">  610</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#a4361eec1c9f93a99661afb1a43d15284">stopTimer</a>() __attribute__((always_inline)) { stopPDB(); }</div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;  <span class="keywordtype">void</span> stopPDB();</div>
<div class="line"><a name="l00613"></a><span class="lineno">  613</span>&#160; </div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160; </div>
<div class="line"><a name="l00618"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#ae3c47b374f4f68eb815812c6a373e439">  618</a></span>&#160;  uint32_t <a class="code" href="class_a_d_c___module.html#ae3c47b374f4f68eb815812c6a373e439">getTimerFrequency</a>() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;    <span class="keywordflow">return</span> getPDBFrequency();</div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;  }</div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160; </div>
<div class="line"><a name="l00625"></a><span class="lineno">  625</span>&#160;  uint32_t getPDBFrequency();</div>
<div class="line"><a name="l00626"></a><span class="lineno">  626</span>&#160; </div>
<div class="line"><a name="l00629"></a><span class="lineno">  629</span>&#160;<span class="preprocessor">#elif defined(ADC_USE_QUAD_TIMER)</span></div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160; </div>
<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;  <span class="keywordtype">void</span> startTimer(uint32_t freq) __attribute__((always_inline)) {</div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;    startQuadTimer(freq);</div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;  }</div>
<div class="line"><a name="l00641"></a><span class="lineno">  641</span>&#160; </div>
<div class="line"><a name="l00646"></a><span class="lineno">  646</span>&#160;  <span class="keywordtype">void</span> startQuadTimer(uint32_t freq);</div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160; </div>
<div class="line"><a name="l00649"></a><span class="lineno">  649</span>&#160;  <span class="keywordtype">void</span> stopTimer() __attribute__((always_inline)) { stopQuadTimer(); }</div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;  <span class="keywordtype">void</span> stopQuadTimer();</div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160; </div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160; </div>
<div class="line"><a name="l00657"></a><span class="lineno">  657</span>&#160;  uint32_t getTimerFrequency() __attribute__((always_inline)) {</div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160;    <span class="keywordflow">return</span> getQuadTimerFrequency();</div>
<div class="line"><a name="l00659"></a><span class="lineno">  659</span>&#160;  }</div>
<div class="line"><a name="l00661"></a><span class="lineno">  661</span>&#160; </div>
<div class="line"><a name="l00664"></a><span class="lineno">  664</span>&#160;  uint32_t getQuadTimerFrequency();</div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00666"></a><span class="lineno">  666</span>&#160; </div>
<div class="line"><a name="l00668"></a><span class="lineno">  668</span>&#160; </div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160; </div>
<div class="line"><a name="l00672"></a><span class="lineno">  672</span>&#160; </div>
<div class="line"><a name="l00675"></a><span class="lineno"><a class="line" href="struct_a_d_c___module_1_1_a_d_c___config.html">  675</a></span>&#160;  <span class="keyword">struct </span><a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html">ADC_Config</a> {</div>
<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160;    uint32_t savedHC0; </div>
<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;    uint32_t savedCFG; </div>
<div class="line"><a name="l00679"></a><span class="lineno">  679</span>&#160;    uint32_t savedGC;  </div>
<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160;    uint32_t savedGS;  </div>
<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00682"></a><span class="lineno"><a class="line" href="struct_a_d_c___module_1_1_a_d_c___config.html#a708e83c3bbd11a06d88802b8941e19a8">  682</a></span>&#160;    uint32_t <a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#a708e83c3bbd11a06d88802b8941e19a8">savedSC1A</a>; </div>
<div class="line"><a name="l00683"></a><span class="lineno"><a class="line" href="struct_a_d_c___module_1_1_a_d_c___config.html#a9f2fc51728d47cd8f6e8b00e8f400296">  683</a></span>&#160;    uint32_t <a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#a9f2fc51728d47cd8f6e8b00e8f400296">savedSC2</a>;  </div>
<div class="line"><a name="l00684"></a><span class="lineno"><a class="line" href="struct_a_d_c___module_1_1_a_d_c___config.html#ae04df65edae35a9beaaec59ce39b1e9e">  684</a></span>&#160;    uint32_t <a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#ae04df65edae35a9beaaec59ce39b1e9e">savedSC3</a>;  </div>
<div class="line"><a name="l00685"></a><span class="lineno"><a class="line" href="struct_a_d_c___module_1_1_a_d_c___config.html#a54092156c81d6dc11b521faf791751f6">  685</a></span>&#160;    uint32_t <a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#a54092156c81d6dc11b521faf791751f6">savedCFG1</a>; </div>
<div class="line"><a name="l00686"></a><span class="lineno"><a class="line" href="struct_a_d_c___module_1_1_a_d_c___config.html#ab1fc8559f2f2f9b9fc0c77a9e67ff2a6">  686</a></span>&#160;    uint32_t <a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#ab1fc8559f2f2f9b9fc0c77a9e67ff2a6">savedCFG2</a>; </div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;  } adc_config; </div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;  uint8_t adcWasInUse;</div>
<div class="line"><a name="l00692"></a><span class="lineno">  692</span>&#160; </div>
<div class="line"><a name="l00696"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#af2ee5bc5b76647506e597c178c9691d3">  696</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#af2ee5bc5b76647506e597c178c9691d3">saveConfig</a>(<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html">ADC_Config</a> *config) {</div>
<div class="line"><a name="l00697"></a><span class="lineno">  697</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00698"></a><span class="lineno">  698</span>&#160;    config-&gt;savedHC0 = adc_regs.HC0;</div>
<div class="line"><a name="l00699"></a><span class="lineno">  699</span>&#160;    config-&gt;savedCFG = adc_regs.CFG;</div>
<div class="line"><a name="l00700"></a><span class="lineno">  700</span>&#160;    config-&gt;savedGC = adc_regs.GC;</div>
<div class="line"><a name="l00701"></a><span class="lineno">  701</span>&#160;    config-&gt;savedGS = adc_regs.GS;</div>
<div class="line"><a name="l00702"></a><span class="lineno">  702</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00703"></a><span class="lineno">  703</span>&#160;    config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#a708e83c3bbd11a06d88802b8941e19a8">savedSC1A</a> = adc_regs.SC1A;</div>
<div class="line"><a name="l00704"></a><span class="lineno">  704</span>&#160;    config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#a54092156c81d6dc11b521faf791751f6">savedCFG1</a> = adc_regs.CFG1;</div>
<div class="line"><a name="l00705"></a><span class="lineno">  705</span>&#160;    config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#ab1fc8559f2f2f9b9fc0c77a9e67ff2a6">savedCFG2</a> = adc_regs.CFG2;</div>
<div class="line"><a name="l00706"></a><span class="lineno">  706</span>&#160;    config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#a9f2fc51728d47cd8f6e8b00e8f400296">savedSC2</a> = adc_regs.SC2;</div>
<div class="line"><a name="l00707"></a><span class="lineno">  707</span>&#160;    config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#ae04df65edae35a9beaaec59ce39b1e9e">savedSC3</a> = adc_regs.SC3;</div>
<div class="line"><a name="l00708"></a><span class="lineno">  708</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00709"></a><span class="lineno">  709</span>&#160;  }</div>
<div class="line"><a name="l00710"></a><span class="lineno">  710</span>&#160; </div>
<div class="line"><a name="l00714"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a1bb50f669bbc41937fb5157abe2050ca">  714</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#a1bb50f669bbc41937fb5157abe2050ca">loadConfig</a>(<span class="keyword">const</span> <a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html">ADC_Config</a> *config) {</div>
<div class="line"><a name="l00715"></a><span class="lineno">  715</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00716"></a><span class="lineno">  716</span>&#160;    adc_regs.HC0 = config-&gt;savedHC0;</div>
<div class="line"><a name="l00717"></a><span class="lineno">  717</span>&#160;    adc_regs.CFG = config-&gt;savedCFG;</div>
<div class="line"><a name="l00718"></a><span class="lineno">  718</span>&#160;    adc_regs.GC = config-&gt;savedGC;</div>
<div class="line"><a name="l00719"></a><span class="lineno">  719</span>&#160;    adc_regs.GS = config-&gt;savedGS;</div>
<div class="line"><a name="l00720"></a><span class="lineno">  720</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00721"></a><span class="lineno">  721</span>&#160;    adc_regs.CFG1 = config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#a54092156c81d6dc11b521faf791751f6">savedCFG1</a>;</div>
<div class="line"><a name="l00722"></a><span class="lineno">  722</span>&#160;    adc_regs.CFG2 = config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#ab1fc8559f2f2f9b9fc0c77a9e67ff2a6">savedCFG2</a>;</div>
<div class="line"><a name="l00723"></a><span class="lineno">  723</span>&#160;    adc_regs.SC2 = config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#a9f2fc51728d47cd8f6e8b00e8f400296">savedSC2</a>;</div>
<div class="line"><a name="l00724"></a><span class="lineno">  724</span>&#160;    adc_regs.SC3 = config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#ae04df65edae35a9beaaec59ce39b1e9e">savedSC3</a>;</div>
<div class="line"><a name="l00725"></a><span class="lineno">  725</span>&#160;    adc_regs.SC1A = config-&gt;<a class="code" href="struct_a_d_c___module_1_1_a_d_c___config.html#a708e83c3bbd11a06d88802b8941e19a8">savedSC1A</a>; <span class="comment">// restore last</span></div>
<div class="line"><a name="l00726"></a><span class="lineno">  726</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00727"></a><span class="lineno">  727</span>&#160;  }</div>
<div class="line"><a name="l00728"></a><span class="lineno">  728</span>&#160; </div>
<div class="line"><a name="l00730"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a27fdc83a7dbe3a8c8c24fc4273414256">  730</a></span>&#160;  uint8_t <a class="code" href="class_a_d_c___module.html#a27fdc83a7dbe3a8c8c24fc4273414256">num_measurements</a>;</div>
<div class="line"><a name="l00731"></a><span class="lineno">  731</span>&#160; </div>
<div class="line"><a name="l00733"></a><span class="lineno">  733</span>&#160; </div>
<div class="line"><a name="l00736"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a2d0cc3360073881658e578faf4ae5632">  736</a></span>&#160;  <span class="keyword">volatile</span> ADC_ERROR <a class="code" href="class_a_d_c___module.html#a2d0cc3360073881658e578faf4ae5632">fail_flag</a>;</div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160; </div>
<div class="line"><a name="l00739"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#abf980784cf468d28fc2cbb94d06be500">  739</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="class_a_d_c___module.html#abf980784cf468d28fc2cbb94d06be500">resetError</a>() { ADC_Error::resetError(fail_flag); }</div>
<div class="line"><a name="l00740"></a><span class="lineno">  740</span>&#160; </div>
<div class="line"><a name="l00742"></a><span class="lineno"><a class="line" href="class_a_d_c___module.html#a29c327df90f71838a36efd3c3b68dd8c">  742</a></span>&#160;  <span class="keyword">const</span> uint8_t <a class="code" href="class_a_d_c___module.html#a29c327df90f71838a36efd3c3b68dd8c">ADC_num</a>;</div>
<div class="line"><a name="l00743"></a><span class="lineno">  743</span>&#160; </div>
<div class="line"><a name="l00745"></a><span class="lineno">  745</span>&#160; </div>
<div class="line"><a name="l00746"></a><span class="lineno">  746</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00747"></a><span class="lineno">  747</span>&#160;  <span class="comment">// is set to 1 when the calibration procedure is taking place</span></div>
<div class="line"><a name="l00748"></a><span class="lineno">  748</span>&#160;  uint8_t calibrating;</div>
<div class="line"><a name="l00749"></a><span class="lineno">  749</span>&#160; </div>
<div class="line"><a name="l00750"></a><span class="lineno">  750</span>&#160;  <span class="comment">// the first calibration will use 32 averages and lowest speed,</span></div>
<div class="line"><a name="l00751"></a><span class="lineno">  751</span>&#160;  <span class="comment">// when this calibration is over the averages and speed will be set to</span></div>
<div class="line"><a name="l00752"></a><span class="lineno">  752</span>&#160;  <span class="comment">// default.</span></div>
<div class="line"><a name="l00753"></a><span class="lineno">  753</span>&#160;  uint8_t init_calib;</div>
<div class="line"><a name="l00754"></a><span class="lineno">  754</span>&#160; </div>
<div class="line"><a name="l00755"></a><span class="lineno">  755</span>&#160;  <span class="comment">// resolution</span></div>
<div class="line"><a name="l00756"></a><span class="lineno">  756</span>&#160;  uint8_t analog_res_bits;</div>
<div class="line"><a name="l00757"></a><span class="lineno">  757</span>&#160; </div>
<div class="line"><a name="l00758"></a><span class="lineno">  758</span>&#160;  <span class="comment">// maximum value possible 2^res-1</span></div>
<div class="line"><a name="l00759"></a><span class="lineno">  759</span>&#160;  uint32_t analog_max_val;</div>
<div class="line"><a name="l00760"></a><span class="lineno">  760</span>&#160; </div>
<div class="line"><a name="l00761"></a><span class="lineno">  761</span>&#160;  <span class="comment">// num of averages</span></div>
<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160;  uint8_t analog_num_average;</div>
<div class="line"><a name="l00763"></a><span class="lineno">  763</span>&#160; </div>
<div class="line"><a name="l00764"></a><span class="lineno">  764</span>&#160;  <span class="comment">// reference can be internal or external</span></div>
<div class="line"><a name="l00765"></a><span class="lineno">  765</span>&#160;  ADC_REF_SOURCE analog_reference_internal;</div>
<div class="line"><a name="l00766"></a><span class="lineno">  766</span>&#160; </div>
<div class="line"><a name="l00767"></a><span class="lineno">  767</span>&#160;<span class="preprocessor">#ifdef ADC_USE_PGA</span></div>
<div class="line"><a name="l00768"></a><span class="lineno">  768</span>&#160;  <span class="comment">// value of the pga</span></div>
<div class="line"><a name="l00769"></a><span class="lineno">  769</span>&#160;  uint8_t pga_value;</div>
<div class="line"><a name="l00770"></a><span class="lineno">  770</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00771"></a><span class="lineno">  771</span>&#160; </div>
<div class="line"><a name="l00772"></a><span class="lineno">  772</span>&#160;  <span class="comment">// conversion speed</span></div>
<div class="line"><a name="l00773"></a><span class="lineno">  773</span>&#160;  <a class="code" href="namespace_a_d_c__settings.html#aab853fc1fcb1992fd5d51408adf7688e">ADC_CONVERSION_SPEED</a> conversion_speed;</div>
<div class="line"><a name="l00774"></a><span class="lineno">  774</span>&#160; </div>
<div class="line"><a name="l00775"></a><span class="lineno">  775</span>&#160;  <span class="comment">// sampling speed</span></div>
<div class="line"><a name="l00776"></a><span class="lineno">  776</span>&#160;  <a class="code" href="namespace_a_d_c__settings.html#af0d80a1aae7288f77b13f0e01d9da0d3">ADC_SAMPLING_SPEED</a> sampling_speed;</div>
<div class="line"><a name="l00777"></a><span class="lineno">  777</span>&#160; </div>
<div class="line"><a name="l00778"></a><span class="lineno">  778</span>&#160;  <span class="comment">// translate pin number to SC1A nomenclature</span></div>
<div class="line"><a name="l00779"></a><span class="lineno">  779</span>&#160;  <span class="keyword">const</span> uint8_t *<span class="keyword">const</span> channel2sc1a;</div>
<div class="line"><a name="l00780"></a><span class="lineno">  780</span>&#160; </div>
<div class="line"><a name="l00781"></a><span class="lineno">  781</span>&#160;  <span class="comment">// are interrupts on?</span></div>
<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;  <span class="keywordtype">bool</span> interrupts_enabled;</div>
<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160; </div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;<span class="comment">// same for differential pins</span></div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;<span class="preprocessor">#if ADC_DIFF_PAIRS &gt; 0</span></div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;  <span class="keyword">const</span> ADC_NLIST *<span class="keyword">const</span> diff_table;</div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160; </div>
<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160;  uint8_t getDifferentialPair(uint8_t pin) {</div>
<div class="line"><a name="l00790"></a><span class="lineno">  790</span>&#160;    <span class="keywordflow">for</span> (uint8_t i = 0; i &lt; ADC_DIFF_PAIRS; i++) {</div>
<div class="line"><a name="l00791"></a><span class="lineno">  791</span>&#160;      <span class="keywordflow">if</span> (diff_table[i].pin == pin) {</div>
<div class="line"><a name="l00792"></a><span class="lineno">  792</span>&#160;        <span class="keywordflow">return</span> diff_table[i].sc1a;</div>
<div class="line"><a name="l00793"></a><span class="lineno">  793</span>&#160;      }</div>
<div class="line"><a name="l00794"></a><span class="lineno">  794</span>&#160;    }</div>
<div class="line"><a name="l00795"></a><span class="lineno">  795</span>&#160;    <span class="keywordflow">return</span> ADC_SC1A_PIN_INVALID;</div>
<div class="line"><a name="l00796"></a><span class="lineno">  796</span>&#160;  }</div>
<div class="line"><a name="l00797"></a><span class="lineno">  797</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00798"></a><span class="lineno">  798</span>&#160; </div>
<div class="line"><a name="l00800"></a><span class="lineno">  800</span>&#160;  <span class="keywordtype">void</span> analog_init();</div>
<div class="line"><a name="l00801"></a><span class="lineno">  801</span>&#160; </div>
<div class="line"><a name="l00803"></a><span class="lineno">  803</span>&#160;  <span class="keywordtype">void</span> startClock() {</div>
<div class="line"><a name="l00804"></a><span class="lineno">  804</span>&#160;<span class="preprocessor">#if defined(ADC_TEENSY_4)</span></div>
<div class="line"><a name="l00805"></a><span class="lineno">  805</span>&#160;    <span class="keywordflow">if</span> (ADC_num == 0) {</div>
<div class="line"><a name="l00806"></a><span class="lineno">  806</span>&#160;      CCM_CCGR1 |= CCM_CCGR1_ADC1(CCM_CCGR_ON);</div>
<div class="line"><a name="l00807"></a><span class="lineno">  807</span>&#160;    } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00808"></a><span class="lineno">  808</span>&#160;      CCM_CCGR1 |= CCM_CCGR1_ADC2(CCM_CCGR_ON);</div>
<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160;    }</div>
<div class="line"><a name="l00810"></a><span class="lineno">  810</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00811"></a><span class="lineno">  811</span>&#160;    <span class="keywordflow">if</span> (ADC_num == 0) {</div>
<div class="line"><a name="l00812"></a><span class="lineno">  812</span>&#160;      SIM_SCGC6 |= SIM_SCGC6_ADC0;</div>
<div class="line"><a name="l00813"></a><span class="lineno">  813</span>&#160;    } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00814"></a><span class="lineno">  814</span>&#160;      SIM_SCGC3 |= SIM_SCGC3_ADC1;</div>
<div class="line"><a name="l00815"></a><span class="lineno">  815</span>&#160;    }</div>
<div class="line"><a name="l00816"></a><span class="lineno">  816</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00817"></a><span class="lineno">  817</span>&#160;  }</div>
<div class="line"><a name="l00818"></a><span class="lineno">  818</span>&#160; </div>
<div class="line"><a name="l00819"></a><span class="lineno">  819</span>&#160;  <span class="comment">// registers point to the correct ADC module</span></div>
<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160;  <span class="keyword">typedef</span> <span class="keyword">volatile</span> uint32_t &amp;reg;</div>
<div class="line"><a name="l00821"></a><span class="lineno">  821</span>&#160; </div>
<div class="line"><a name="l00822"></a><span class="lineno">  822</span>&#160;  <span class="comment">// registers that control the adc module</span></div>
<div class="line"><a name="l00823"></a><span class="lineno">  823</span>&#160;  ADC_REGS_t &amp;adc_regs;</div>
<div class="line"><a name="l00824"></a><span class="lineno">  824</span>&#160; </div>
<div class="line"><a name="l00825"></a><span class="lineno">  825</span>&#160;<span class="preprocessor">#ifdef ADC_USE_PDB</span></div>
<div class="line"><a name="l00826"></a><span class="lineno">  826</span>&#160;  reg PDB0_CHnC1; <span class="comment">// PDB channel 0 or 1</span></div>
<div class="line"><a name="l00827"></a><span class="lineno">  827</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00828"></a><span class="lineno">  828</span>&#160;<span class="preprocessor">#ifdef ADC_TEENSY_4</span></div>
<div class="line"><a name="l00829"></a><span class="lineno">  829</span>&#160;  uint8_t XBAR_IN;</div>
<div class="line"><a name="l00830"></a><span class="lineno">  830</span>&#160;  uint8_t XBAR_OUT;</div>
<div class="line"><a name="l00831"></a><span class="lineno">  831</span>&#160;  uint8_t QTIMER4_INDEX;</div>
<div class="line"><a name="l00832"></a><span class="lineno">  832</span>&#160;  uint8_t ADC_ETC_TRIGGER_INDEX;</div>
<div class="line"><a name="l00833"></a><span class="lineno">  833</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00834"></a><span class="lineno">  834</span>&#160;  <span class="keyword">const</span> IRQ_NUMBER_t IRQ_ADC; <span class="comment">// IRQ number</span></div>
<div class="line"><a name="l00835"></a><span class="lineno">  835</span>&#160; </div>
<div class="line"><a name="l00836"></a><span class="lineno">  836</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00837"></a><span class="lineno">  837</span>&#160;};</div>
<div class="line"><a name="l00838"></a><span class="lineno">  838</span>&#160; </div>
<div class="line"><a name="l00839"></a><span class="lineno">  839</span>&#160;<span class="preprocessor">#endif // ADC_MODULE_H</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aclass_a_d_c___module_html_a4f6124f3fee4cae59f011184525822a6"><div class="ttname"><a href="class_a_d_c___module.html#a4f6124f3fee4cae59f011184525822a6">ADC_Module::isDifferential</a></div><div class="ttdeci">volatile bool isDifferential()</div><div class="ttdoc">Is the ADC in differential mode?</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00353">ADC_Module.h:353</a></div></div>
<div class="ttc" id="astruct_a_d_c___module_1_1_a_d_c___config_html_a708e83c3bbd11a06d88802b8941e19a8"><div class="ttname"><a href="struct_a_d_c___module_1_1_a_d_c___config.html#a708e83c3bbd11a06d88802b8941e19a8">ADC_Module::ADC_Config::savedSC1A</a></div><div class="ttdeci">uint32_t savedSC1A</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00682">ADC_Module.h:682</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a1bb50f669bbc41937fb5157abe2050ca"><div class="ttname"><a href="class_a_d_c___module.html#a1bb50f669bbc41937fb5157abe2050ca">ADC_Module::loadConfig</a></div><div class="ttdeci">void loadConfig(const ADC_Config *config)</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00714">ADC_Module.h:714</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a4f8137bfcdc459b4f8767ad46f325af6"><div class="ttname"><a href="class_a_d_c___module.html#a4f8137bfcdc459b4f8767ad46f325af6">ADC_Module::setSoftwareTrigger</a></div><div class="ttdeci">void setSoftwareTrigger()</div><div class="ttdoc">Use software to trigger the ADC, this is the most common setting.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00294">ADC_Module.h:294</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a4361eec1c9f93a99661afb1a43d15284"><div class="ttname"><a href="class_a_d_c___module.html#a4361eec1c9f93a99661afb1a43d15284">ADC_Module::stopTimer</a></div><div class="ttdeci">void stopTimer()</div><div class="ttdoc">Stop the default timer (PDB)</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00610">ADC_Module.h:610</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_af2ee5bc5b76647506e597c178c9691d3"><div class="ttname"><a href="class_a_d_c___module.html#af2ee5bc5b76647506e597c178c9691d3">ADC_Module::saveConfig</a></div><div class="ttdeci">void saveConfig(ADC_Config *config)</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00696">ADC_Module.h:696</a></div></div>
<div class="ttc" id="astruct_a_d_c___module_1_1_a_d_c___config_html_a54092156c81d6dc11b521faf791751f6"><div class="ttname"><a href="struct_a_d_c___module_1_1_a_d_c___config.html#a54092156c81d6dc11b521faf791751f6">ADC_Module::ADC_Config::savedCFG1</a></div><div class="ttdeci">uint32_t savedCFG1</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00685">ADC_Module.h:685</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_abf980784cf468d28fc2cbb94d06be500"><div class="ttname"><a href="class_a_d_c___module.html#abf980784cf468d28fc2cbb94d06be500">ADC_Module::resetError</a></div><div class="ttdeci">void resetError()</div><div class="ttdoc">Resets all errors from the ADC, if any.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00739">ADC_Module.h:739</a></div></div>
<div class="ttc" id="anamespace_a_d_c__settings_html"><div class="ttname"><a href="namespace_a_d_c__settings.html">ADC_settings</a></div><div class="ttdoc">Board-dependent settings.</div><div class="ttdef"><b>Definition:</b> <a href="settings__defines_8h_source.html#l00041">settings_defines.h:41</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a8bddd248a9d52110b923fa94438f7f0a"><div class="ttname"><a href="class_a_d_c___module.html#a8bddd248a9d52110b923fa94438f7f0a">ADC_Module::analogReadContinuous</a></div><div class="ttdeci">int analogReadContinuous()</div><div class="ttdoc">Reads the analog value of a continuous conversion.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00563">ADC_Module.h:563</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html"><div class="ttname"><a href="class_a_d_c___module.html">ADC_Module</a></div><div class="ttdoc">Implements all functions of the Teensy 3.x, LC, 4.x analog to digital converter.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00054">ADC_Module.h:54</a></div></div>
<div class="ttc" id="astruct_a_d_c___module_1_1_a_d_c___config_html"><div class="ttname"><a href="struct_a_d_c___module_1_1_a_d_c___config.html">ADC_Module::ADC_Config</a></div><div class="ttdoc">Store the config of the adc.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00675">ADC_Module.h:675</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_aa5f004d8433dc5968af0ec7f17b1f576"><div class="ttname"><a href="class_a_d_c___module.html#aa5f004d8433dc5968af0ec7f17b1f576">ADC_Module::setHardwareTrigger</a></div><div class="ttdeci">void setHardwareTrigger()</div><div class="ttdoc">Use hardware to trigger the ADC.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00303">ADC_Module.h:303</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a60d0edc82fd1dbb2e20d090a53718ce2"><div class="ttname"><a href="class_a_d_c___module.html#a60d0edc82fd1dbb2e20d090a53718ce2">ADC_Module::readSingle</a></div><div class="ttdeci">int readSingle()</div><div class="ttdoc">Reads the analog value of a single conversion. Set the conversion with with startSingleRead(uint8_t p...</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00517">ADC_Module.h:517</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a8b00e0669bbc7917544d4e2e543f1a27"><div class="ttname"><a href="class_a_d_c___module.html#a8b00e0669bbc7917544d4e2e543f1a27">ADC_Module::continuousMode</a></div><div class="ttdeci">void continuousMode()</div><div class="ttdoc">Set continuous conversion mode.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00262">ADC_Module.h:262</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a29c327df90f71838a36efd3c3b68dd8c"><div class="ttname"><a href="class_a_d_c___module.html#a29c327df90f71838a36efd3c3b68dd8c">ADC_Module::ADC_num</a></div><div class="ttdeci">const uint8_t ADC_num</div><div class="ttdoc">Which adc is this?</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00742">ADC_Module.h:742</a></div></div>
<div class="ttc" id="anamespace_a_d_c__settings_html_af0d80a1aae7288f77b13f0e01d9da0d3"><div class="ttname"><a href="namespace_a_d_c__settings.html#af0d80a1aae7288f77b13f0e01d9da0d3">ADC_settings::ADC_SAMPLING_SPEED</a></div><div class="ttdeci">ADC_SAMPLING_SPEED</div><div class="ttdoc">ADC sampling speed. It selects how many ADCK clock cycles to add.</div><div class="ttdef"><b>Definition:</b> <a href="settings__defines_8h_source.html#l00603">settings_defines.h:603</a></div></div>
<div class="ttc" id="astruct_a_d_c___module_1_1_a_d_c___config_html_ab1fc8559f2f2f9b9fc0c77a9e67ff2a6"><div class="ttname"><a href="struct_a_d_c___module_1_1_a_d_c___config.html#ab1fc8559f2f2f9b9fc0c77a9e67ff2a6">ADC_Module::ADC_Config::savedCFG2</a></div><div class="ttdeci">uint32_t savedCFG2</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00686">ADC_Module.h:686</a></div></div>
<div class="ttc" id="anamespace_a_d_c__settings_html_a8c2a64f3fca3ac6b82e8df8cf44f6ca2"><div class="ttname"><a href="namespace_a_d_c__settings.html#a8c2a64f3fca3ac6b82e8df8cf44f6ca2">ADC_settings::ADC_INTERNAL_SOURCE</a></div><div class="ttdeci">ADC_INTERNAL_SOURCE</div><div class="ttdoc">Other ADC sources to measure, such as the temperature sensor.</div><div class="ttdef"><b>Definition:</b> <a href="settings__defines_8h_source.html#l00268">settings_defines.h:268</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_ae3c47b374f4f68eb815812c6a373e439"><div class="ttname"><a href="class_a_d_c___module.html#ae3c47b374f4f68eb815812c6a373e439">ADC_Module::getTimerFrequency</a></div><div class="ttdeci">uint32_t getTimerFrequency()</div><div class="ttdoc">Return the default timer's (PDB) frequency.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00618">ADC_Module.h:618</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a27fdc83a7dbe3a8c8c24fc4273414256"><div class="ttname"><a href="class_a_d_c___module.html#a27fdc83a7dbe3a8c8c24fc4273414256">ADC_Module::num_measurements</a></div><div class="ttdeci">uint8_t num_measurements</div><div class="ttdoc">Number of measurements that the ADC is performing.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00730">ADC_Module.h:730</a></div></div>
<div class="ttc" id="anamespace_a_d_c___error_html_ad050c44d1f3422d02e5f9726edeee8f0"><div class="ttname"><a href="namespace_a_d_c___error.html#ad050c44d1f3422d02e5f9726edeee8f0">ADC_Error::ADC_ERROR</a></div><div class="ttdeci">ADC_ERROR</div><div class="ttdoc">ADC errors. Each board has a adc-&gt;adX-&gt;fail_flag. Include ADC_util.h and use getStringADCError to pri...</div><div class="ttdef"><b>Definition:</b> <a href="settings__defines_8h_source.html#l00661">settings_defines.h:661</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a038874878778ef351e45f902fcee47df"><div class="ttname"><a href="class_a_d_c___module.html#a038874878778ef351e45f902fcee47df">ADC_Module::isContinuous</a></div><div class="ttdeci">volatile bool isContinuous()</div><div class="ttdoc">Is the ADC in continuous mode?</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00362">ADC_Module.h:362</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a7edf0189517f42a2bcbc389c116d9f58"><div class="ttname"><a href="class_a_d_c___module.html#a7edf0189517f42a2bcbc389c116d9f58">ADC_Module::singleEndedMode</a></div><div class="ttdeci">void singleEndedMode()</div><div class="ttdoc">Set single-ended conversion mode.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00279">ADC_Module.h:279</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_aebdd7b54f91fe0834321fb632177151e"><div class="ttname"><a href="class_a_d_c___module.html#aebdd7b54f91fe0834321fb632177151e">ADC_Module::startTimer</a></div><div class="ttdeci">void startTimer(uint32_t freq)</div><div class="ttdoc">Start the default timer (PDB) triggering the ADC at the frequency.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00598">ADC_Module.h:598</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a3aefadc245d1582d3ae97e1b9c7acac8"><div class="ttname"><a href="class_a_d_c___module.html#a3aefadc245d1582d3ae97e1b9c7acac8">ADC_Module::isComplete</a></div><div class="ttdeci">volatile bool isComplete()</div><div class="ttdoc">Is an ADC conversion ready?</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00340">ADC_Module.h:340</a></div></div>
<div class="ttc" id="anamespace_a_d_c__settings_html_a5f42fd9e070e88475ec7cee39bbf4f8d"><div class="ttname"><a href="namespace_a_d_c__settings.html#a5f42fd9e070e88475ec7cee39bbf4f8d">ADC_settings::ADC_REFERENCE</a></div><div class="ttdeci">ADC_REFERENCE</div><div class="ttdoc">Voltage reference for the ADC default is the external, that is connected to the 3....</div><div class="ttdef"><b>Definition:</b> <a href="settings__defines_8h_source.html#l00178">settings_defines.h:178</a></div></div>
<div class="ttc" id="astruct_a_d_c___module_1_1_a_d_c___config_html_a9f2fc51728d47cd8f6e8b00e8f400296"><div class="ttname"><a href="struct_a_d_c___module_1_1_a_d_c___config.html#a9f2fc51728d47cd8f6e8b00e8f400296">ADC_Module::ADC_Config::savedSC2</a></div><div class="ttdeci">uint32_t savedSC2</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00683">ADC_Module.h:683</a></div></div>
<div class="ttc" id="anamespace_a_d_c__settings_html_aab853fc1fcb1992fd5d51408adf7688e"><div class="ttname"><a href="namespace_a_d_c__settings.html#aab853fc1fcb1992fd5d51408adf7688e">ADC_settings::ADC_CONVERSION_SPEED</a></div><div class="ttdeci">ADC_CONVERSION_SPEED</div><div class="ttdoc">ADC conversion speed. Common set of options to select the ADC clock speed F_ADCK, which depends on AD...</div><div class="ttdef"><b>Definition:</b> <a href="settings__defines_8h_source.html#l00562">settings_defines.h:562</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a6eaddace77e00a063abeb7331fae6abe"><div class="ttname"><a href="class_a_d_c___module.html#a6eaddace77e00a063abeb7331fae6abe">ADC_Module::analogRead</a></div><div class="ttdeci">int analogRead(ADC_INTERNAL_SOURCE pin)</div><div class="ttdoc">Returns the analog value of the special internal source, such as the temperature sensor.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00459">ADC_Module.h:459</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a2d0cc3360073881658e578faf4ae5632"><div class="ttname"><a href="class_a_d_c___module.html#a2d0cc3360073881658e578faf4ae5632">ADC_Module::fail_flag</a></div><div class="ttdeci">volatile ADC_ERROR fail_flag</div><div class="ttdoc">This flag indicates that some kind of error took place.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00736">ADC_Module.h:736</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a0f7d83ced9a5159b1f25bd998cea2bd0"><div class="ttname"><a href="class_a_d_c___module.html#a0f7d83ced9a5159b1f25bd998cea2bd0">ADC_Module::singleMode</a></div><div class="ttdeci">void singleMode()</div><div class="ttdoc">Set single-shot conversion mode.</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00270">ADC_Module.h:270</a></div></div>
<div class="ttc" id="astruct_a_d_c___module_1_1_a_d_c___config_html_ae04df65edae35a9beaaec59ce39b1e9e"><div class="ttname"><a href="struct_a_d_c___module_1_1_a_d_c___config.html#ae04df65edae35a9beaaec59ce39b1e9e">ADC_Module::ADC_Config::savedSC3</a></div><div class="ttdeci">uint32_t savedSC3</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00684">ADC_Module.h:684</a></div></div>
<div class="ttc" id="aclass_a_d_c___module_html_a9facd614ff4fec667341d9109f098f0f"><div class="ttname"><a href="class_a_d_c___module.html#a9facd614ff4fec667341d9109f098f0f">ADC_Module::isConverting</a></div><div class="ttdeci">volatile bool isConverting()</div><div class="ttdoc">Is the ADC converting at the moment?</div><div class="ttdef"><b>Definition:</b> <a href="_a_d_c___module_8h_source.html#l00323">ADC_Module.h:323</a></div></div>
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>ADC_Module.h</b></li>
    <li class="footer">Generated on Tue Nov 29 2022 23:16:03 for ADC by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
  </ul>
</div>
</body>
</html>
